package com.project.sevice.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ManBean;
import com.project.mapper.IManMapper;
import com.project.sevice.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

/**
 * @Author(王思翰)
 * @Description(类的描述)
 * @Date(创建时间) 2021/7/19 15:57
 */
@Service
@Transactional
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper mapper;

    @Override
    public void add(ManBean manBean) {
        mapper.add(manBean);
    }

    @Override
    public PageInfo<ManBean> findAll(int pageNo) {
        PageHelper.startPage(pageNo,3);
        PageInfo<ManBean> pageInfo =PageInfo.of(mapper.findAll());
        return pageInfo;
    }

    @Override
    public void del(int manId) {
        mapper.del(manId);
    }

    @Override
    public ManBean findById(int manId) {
       return mapper.findById(manId);
    }

    @Override
    public void update(int manId, LocalDate birthday) {
        mapper.update(manId,birthday);
    }
}
